package com.yc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yc.entity.Comment;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * InnoDB free: 4096 kB Mapper 接口
 * </p>
 *
 * @author ly
 * @since 2022-05-25
 */
public interface CommentMapper extends BaseMapper<Comment> {
    @Select("SELECT * from comment where ctid=#{ctid} order by cmdate desc")
    public List<Comment> queryByCtid(Integer ctid);

    @Update("update comment set praisenum=praisenum+1 where cmid=#{cmid} and ctid=#{ctid} and uid=#{uid}")
    public Integer addPraise(Integer cmid,Integer ctid,Integer uid);

    @Update("update comment set stampnum=stampnum+1 where cmid=#{cmid} and ctid=#{ctid} and uid=#{uid}")
    public Integer addStamp(Integer cmid, Integer ctid, Integer uid);
}
